package com.onec.service.channel.service.channel.jft.util;

import lombok.Data;

/**
 * jft 请求返回对象。
 * @author onec
 */
@Data
public class JftReturnModel {

    private static final String SUCCESS_CODE = "0000";
    private static final String ERROR_CODE = "0096";
    private static final String SUCCESS_STATUS = "0";
    private static final String DOING_STATUS = "1";
    private static final String FAILED_STATUS = "2";
    private static final String INIT_STATUS = "3";


    private String orderCode;
    private String chMerCode;
    private String busCode;
    private String tranAmount;
    private String tranTime;
    private String chSerialNo;
    // 交易状态
    //
    // 0：成功
    // 1：处理中
    //2：失败
    //3：待支付
    private String tranStatus;
    private String resultType;
    private String url;
    private String realName;
    private String accNo;
    private String drawStatus;
    private String drawAmount;
    private String balance;
    private String resCode;
    private String resMsg;

    public boolean isSuccess() {
        return SUCCESS_CODE.equals(this.resCode);
    }

    public boolean isTranSuccess() {
        return SUCCESS_CODE.equals(this.resCode) && SUCCESS_STATUS.equals(this.tranStatus);
    }

    public boolean isDoing() {
        return SUCCESS_CODE.equals(this.resCode) && DOING_STATUS.equals(this.tranStatus);
    }

    public boolean isInit() {
        return SUCCESS_CODE.equals(this.resCode) && INIT_STATUS.equals(this.tranStatus);
    }

    public boolean isFailed() {
        return !SUCCESS_CODE.equals(this.resCode) && !ERROR_CODE.equals(this.resCode) || FAILED_STATUS.equals(this.tranStatus);
    }

    public boolean isError() {
        return ERROR_CODE.equals(this.resCode);
    }

}
